package com.itheima.d1_exception;

import com.sun.tools.attach.AgentInitializationException;


public class ExceptionTest2 {
    public static void main(String[] args) {
        try {
            setAge(2123);
        } catch (AgeOutBoundException e) {
            throw new RuntimeException(e);
        }
    }
    public static void setAge(int age) /*throws AgeOutBoundException*/ {
        if (age > 18&&age<200) {
            System.out.println("年龄范围设置合理");
        }else {
            System.out.println("年龄不合理");
            throw new AgeOutBoundException("年龄超范围");
        }
    }
}
